package com.wedata.海康云;

import cn.hutool.json.JSONObject;
import com.disdr.utils.DateUtils;
import com.wedata.HttpUtils;

import java.util.Date;

public class 门禁事件查询 extends BaseService{

    public static void main(String[] args) {
        searchAuthPage();
    }

    /**
     * 查询门禁出入事件
     * https://open.hikyun.com/1/document/429#947
     * @return
     */
    public static String searchAuthPage(){
        JSONObject param = new JSONObject();
        //必填字段
        param.set("pageNo",1);
        param.set("pageSize",10);
        //param.set("eventStartTime", "2025-01-15T14:49:27+08:00");
        param.set("eventStartTime", "2025-02-07T08:30:00+08:00");
        param.set("eventEndTime", "2025-02-08T19:31:00+08:00");
        // 选填字段
        //海康人员ID ： trade_face_ids 表 v3_person_id 字段
        String[] personIds = new String[]{"1689278951369704"};
        param.set("personIds",personIds);

        //海康设备 ： trade_face_device 表 hik_sn 字段
        //String[] deviceSerials = new String[]{"FQ1788082"};
        //param.set("deviceSerials", deviceSerials);
        //海康人员分组 ： trade_shop 表 face_group_code 字段
        //param.set("personGroupId", "283102893773800");


        JSONObject header = new JSONObject("{\"access_token\":\""+getToken()+"\"}");
        JSONObject jsonObject = HttpUtils.sendPost("https://open.hikyun.com/artemis/api/eits/aceventcs/v1/event/acs/person/page",header,param);

        System.out.println(jsonObject);
        return jsonObject.toString();
    }


}
